package com.sdkx.wear_os.ui.activity

import android.content.Intent
import com.sdkx.wear_os.R
import com.sdkx.wear_os.app.MyApplication.Companion.fastKV
import com.sdkx.wear_os.base.BaseActivity
import com.sdkx.wear_os.base.BaseViewModel
import com.sdkx.wear_os.bean.Constant.Companion.APP_TOKEN
import com.sdkx.wear_os.databinding.ActivityStartBinding
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

/**
 * 启动页
 */
class StartActivity : BaseActivity<BaseViewModel, ActivityStartBinding>() {
    override fun initLayout(): Int = R.layout.activity_start

    override fun initView() {
    }

    override fun initData() {
        MainScope().launch {
            //延迟两秒跳转
//            delay(2000)
//            if (fastKV.getString(APP_TOKEN, "").isEmpty()) {
//                //如果Token是空的 跳转登录
//                startActivity(Intent(this@StartActivity, LoginActivity::class.java))
//            } else {
            //如果Token不是空的 跳转首页
            startActivity(Intent(this@StartActivity, MainActivity::class.java))
//            }
            finish()
        }
    }

    override fun initListener() {

    }
}